
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    TextInput,
    Image,
    StatusBar,
    PixelRatio,
    View,
    TouchableOpacity
} from 'react-native';


import styles from './assets/css/style.js';
import LoginUtils from './src/util/login';
import zhuangtai from './zhuangtaibei'
import { StackNavigator } from 'react-navigation';
import { TabNavigator } from "react-navigation";

export default class project extends Component {
    static navigationOptions = {
        title: ''
    };
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        const {params}=this.props.navigation.state;
        return (
            <View style={styles.container}>

                <StatusBar
                    barStyle="dark-content"
                    backgroundColor='#fff'
                    translucent={true}
                    hidden={false}
                    animated={true}
                />
                <View>
                    <Image
                        style={styles.logo}
                        source={require('./assets/img/logo.png')}
                    />
                </View>
                <View style={styles.wrap}>
                    <View style={styles.list}>
                        <View style={styles.icon}>
                            <Image
                                style={[styles.flex,styles.img]}
                                source={require("./assets/img/icon_use.png")}
                                resizeMode="contain"
                            />
                        </View>
                        <TextInput
                            style={[styles.Text]}
                            placeholder="user"
                            underlineColorAndroid="transparent"
                            selectTextOnFocus={true}
                            onChangeText={(text) => this.setState({userName: text})}
                        />
                    </View>
                    <View style={styles.list}>
                        <View style={styles.icon}>
                            <Image
                                style={[styles.flex,styles.img]}
                                source={require("./assets/img/icon_pass.png")}
                                resizeMode="contain"
                            />
                        </View>
                        <TextInput
                            style={[styles.Text]}
                            placeholder="password"
                            secureTextEntry={true}
                            underlineColorAndroid="transparent"
                            selectTextOnFocus={true}
                            onChangeText={(text) => this.setState({password: text})}
                        />
                    </View>
                    <TouchableOpacity onPress={LoginUtils.sign.bind(this, this.state.userName, this.state.password)}>
                        <View style={[styles.list,styles.center,styles.blue]}>
                            <Text
                                style={styles.sign}
                            >sign</Text>
                        </View>
                    </TouchableOpacity>
                    <View style={[styles.list,styles.center,styles.blue]}>
                        <Text
                            style={styles.sign}
                            onPress={() => this.props.navigation.navigate('zhuangTai', { user: 'zt' })}
                        >mysign</Text>
                    </View>

                </View>

            </View>
        );
    }
}


const navTab = StackNavigator({
    Main: { screen: project },
    zhuangTai: { screen: zhuangtai }
});


AppRegistry.registerComponent('iHGuapp', () => navTab);